<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019-3-12
  Time: 上午 10:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>展示学生列表</title>
</head>
<script type="text/javascript">
    function btninsert() {
        window.location.href="toinsert"
    }
    function btnUpdate(id) {
        window.location.href="toUpdate?id="+id
    }
    function btnDel(id) {
        window.location.href="delActiom?id="+id
        alert(id)
    }
</script>
<body>
<table border="1" style="background-color: aqua" id="tab">
    <tr>
        <td>id</td>
        <td>name</td>
        <td>score</td>
        <td colspan="2">操作</td>
    </tr>
    <c:forEach items="${studentEntity}" var="stu">
        <tr>
            <td id="id">${stu.id}</td>
            <td>${stu.name}</td>
            <td>${stu.score}</td>
            <td><button style="width: 50px;background-color: brown"  type="button" name="id" onclick="btnDel(${stu.id})">删除</button></td>
            <td><button style="width: 50px;background-color: coral"  type="button" onclick="btnUpdate(${stu.id})">编辑</button></td>
        </tr>
    </c:forEach>
    <tr>
        <td colspan="5">
            <button style="width: 250px;background-color: aquamarine" type="button" onclick="btninsert()">添加</button>
        </td>
    </tr>
</table>
</body>
</html>

